<template>
  <h2>父组件{{money}}</h2>
  <button @click="money = 1000">发钱</button>

  <sons></sons>
</template>

<script>
import sons from './components/sons.vue'
import { ref,provide } from "vue";
export default {
  components:{
    sons
  },
  setup() {
    const money = ref(100);
    


    // const getmoney = (newmoney) => {
    //   console.log('getmoney',newmoney);
    //   money.value = money.value - newmoney
    // };
    const number = ref(50)
    provide('getmoney',(number)=>{
      money.value -= number
    })
    provide('money',money)
    return {money}
  },
};
</script>

<style>
</style>